﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
using DbDoc.PowerDoc.ViewModel;

namespace PowerDoc
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        private void OnStartup(object sender, StartupEventArgs args)
        {
            var popup = (Action<string>)( msg => MessageBox.Show (msg));          
            var popupInfo= (Action<string, string>)((msg, caption) => MessageBox.Show(msg,caption, MessageBoxButton.OK,  MessageBoxImage.Information));
            var popupError = (Action<string, string>)((msg, caption) => MessageBox.Show(msg, caption, MessageBoxButton.OK, MessageBoxImage.Error));

            DbDoc.PowerDoc.Views.MainWindow main = new DbDoc.PowerDoc.Views.MainWindow(popupInfo, popupError);
            main.Show();            
        }

        private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
        {
            MessageBox.Show(e.Exception.Message);
            MessageBox.Show(e.Exception.InnerException.Message);
        }
    }
}
